package com.zghhost.codedemo.other;

import com.alibaba.fastjson.JSON;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.File;
import java.io.FileInputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;

/**
 * @author guohua.zhang@zhaopin.com.cn
 * @Date 2019/7/18 13:20
 */
public class CepingXls {
    public static void main(String[] args)throws Exception{
        XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(new File("/Users/wow/jianguo_cloud/zhaipin_work/ai面试/6a9730badcba1aad.xlsx")));
//        XSSFSheet sheet0 = workbook.getSheetAt(0);
        XSSFSheet sheet = workbook.getSheetAt(1);
        List<List<String>> dist = new ArrayList<>();
        for(int i=3,ic=12;i<=ic;i++){
            List<String> row = new ArrayList<>();
            for(int j=0,jc=27;j<=jc;j++){
                row.add(URLEncoder.encode(String.valueOf(sheet.getRow(i).getCell(j)),"utf-8"));
            }
            dist.add(row);
        }

        System.out.println(JSON.toJSONString(dist));
    }
}
